/* 
 * File:   EvolutionOfCreatures.h
 * Author: jcrada
 *
 * Created on April 11, 2009, 3:41 PM
 */

#ifndef _EVOLUTIONOFCREATURES_H
#define	_EVOLUTIONOFCREATURES_H

#include "Creature.h"

namespace jcrada {

    class EvolutionOfCreatures {
    private:
        int _population_size;
        Creature** _creatures;
        int _evaluation_time;

    protected:

        virtual void setCreature( int index, Creature* creature ) {
            assert(index >= 0 && index < getPopulationSize());
            this->_creatures[index] = creature;
        }
    public:
        EvolutionOfCreatures( int population_size );
        virtual ~EvolutionOfCreatures( );

        virtual void step( ) = 0;
        virtual void prepareCreatures( ) = 0;

        virtual int getPopulationSize( ) const {
            return this->_population_size;
        }

        virtual Creature& getCreature( int index ) const {
            assert(index >= 0 && index < getPopulationSize());
            return *this->_creatures[index];
        }

        virtual Creature** getCreatures() const{
            return this->_creatures;
        }

        virtual void setEvaluationTime( int seconds ) {
            this->_evaluation_time = seconds;
        }

        virtual int getEvaluationTime( ) const {
            return this->_evaluation_time;
        }
    };
}

#endif	/* _EVOLUTIONOFCREATURES_H */

